//
//  UIView+Extension.h
//  titleButton
//
//  Created by apple on 2017/9/27.
//  Copyright © 2017年 铁科院. All rights reserved.
//

#import <UIKit/UIKit.h>
/**
 *  Direction of flip animation
 */
typedef NS_ENUM(NSInteger, UIViewAnimationFlipDirection)
{
    /**
     *  Flip animation from top
     */
    UIViewAnimationFlipDirectionFromTop = 0,
    /**
     *  Flip animation from left
     */
    UIViewAnimationFlipDirectionFromLeft,
    /**
     *  Flip animation from right
     */
    UIViewAnimationFlipDirectionFromRight,
    /**
     *  Flip animation from bottom
     */
    UIViewAnimationFlipDirectionFromBottom
};

/**
 *  Direction of the translation
 */
typedef NS_ENUM(NSInteger, UIViewAnimationTranslationDirection)
{
    /**
     *  Translation from left to right
     */
    UIViewAnimationTranslationDirectionFromLeftToRight = 0,
    /**
     *  Translation from right to left
     */
    UIViewAnimationTranslationDirectionFromRightToLeft
};

/**
 *  Direction of the linear gradient
 */
typedef NS_ENUM(NSInteger, UIViewLinearGradientDirection)
{
    /**
     *  Linear gradient vertical
     */
    UIViewLinearGradientDirectionVertical = 0,
    /**
     *  Linear gradient horizontal
     */
    UIViewLinearGradientDirectionHorizontal,
    /**
     *  Linear gradient from left to right and top to down
     */
    UIViewLinearGradientDirectionDiagonalFromLeftToRightAndTopToDown,
    /**
     *  Linear gradient from left to right and down to top
     */
    UIViewLinearGradientDirectionDiagonalFromLeftToRightAndDownToTop,
    /**
     *  Linear gradient from right to left and top to down
     */
    UIViewLinearGradientDirectionDiagonalFromRightToLeftAndTopToDown,
    /**
     *  Linear gradient from right to left and down to top
     */
    UIViewLinearGradientDirectionDiagonalFromRightToLeftAndDownToTop
};

@interface UIView (Extension)
@property (nonatomic, assign) CGSize kx_size;
@property (nonatomic, assign) CGFloat kx_width;
@property (nonatomic, assign) CGFloat kx_height;
@property (nonatomic, assign) CGFloat kx_x;
@property (nonatomic, assign) CGFloat kx_y;
@property (nonatomic, assign) CGFloat kx_centerX;
@property (nonatomic, assign) CGFloat kx_centerY;

@property (nonatomic, assign) CGFloat kx_right;
@property (nonatomic, assign) CGFloat kx_bottom;

+ (instancetype)viewFromXib;

- (BOOL)intersectWithView:(UIView *)view;

- (void)tky_cornerWithRadius:(CGFloat)radius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth;



/**
 *  1.设置颜色
 */
- (UIView *(^)(UIColor *color)) setColor;

/**
 *  2.设置框架
 */
- (UIView *(^)(CGRect frame)) setFrame;

/**
 *  3.设置尺寸
 */
- (UIView *(^)(CGSize size)) setSize;

/**
 *  4.设置中心点
 */
- (UIView *(^)(CGPoint point)) setCenter;

/**
 *  5.设置标签值
 */
- (UIView *(^)(NSInteger tag)) setTag;

/** 1.给UIView添加点击事件 */
- (void)LX_AddTarget:(id)target
               action:(SEL)action;

/** 2.UIView的类初始化 */
+ (UIView *)LX_ViewWithFrame:(CGRect)frame
              backgroundColor:(UIColor *)backgroundColor;

/** 3.设置边框 */
- (void)LX_SetBordersWithColor:(UIColor *)color
                andCornerRadius:(CGFloat)radius
                       andWidth:(CGFloat)width;

/** 4.删除边框 */
- (void)LX_RemoveBorders;

/** 5.设置阴影 */
- (void)LX_SetRectShadowWithOffset:(CGSize)offset
                            opacity:(CGFloat)opacity
                             radius:(CGFloat)radius;

/** 6.删除阴影 */
- (void)LX_RemoveShadow;

/** 7.设置圆角半径阴影 */
- (void)LX_SetCornerRadiusShadowWithCornerRadius:(CGFloat)cornerRadius
                                           offset:(CGSize)offset
                                          opacity:(CGFloat)opacity
                                           radius:(CGFloat)radius;

/** 8.设置圆角半径 */
- (void)LX_SetCornerRadius:(CGFloat)radius;

/** 9.摇摆动画 */
- (void)LX_ShakeView;

/** 10.脉冲动画 */
- (void)LX_PulseViewWithTime:(CGFloat)seconds;

/** 11.渐变色 */
- (void)LX_CreateGradientWithColors:(NSArray *)colors direction:(UIViewLinearGradientDirection)direction;

/** 12.添加子View */
- (void)LX_AddSubViewsWithArray:(NSArray *)array;

/** 13.获取当前View的VC */
- (UIViewController *)LX_GetCurrentViewController;
/** 14.获取当前view的NAVI */
- (UINavigationController *)LX_GetCurrentNavigationController;
@end
